package com.cloudspace.jindun.dao;

import android.database.sqlite.SQLiteDatabase;

import java.util.Map;

import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.AbstractDaoSession;
import de.greenrobot.dao.identityscope.IdentityScopeType;
import de.greenrobot.dao.internal.DaoConfig;

import com.cloudspace.jindun.dao.NoticeMessage;
import com.cloudspace.jindun.dao.PhoneRecord;
import com.cloudspace.jindun.dao.ContactPerson;
import com.cloudspace.jindun.dao.LoginUser;

import com.cloudspace.jindun.dao.NoticeMessageDao;
import com.cloudspace.jindun.dao.PhoneRecordDao;
import com.cloudspace.jindun.dao.ContactPersonDao;
import com.cloudspace.jindun.dao.LoginUserDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see de.greenrobot.dao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig noticeMessageDaoConfig;
    private final DaoConfig phoneRecordDaoConfig;
    private final DaoConfig contactPersonDaoConfig;
    private final DaoConfig loginUserDaoConfig;

    private final NoticeMessageDao noticeMessageDao;
    private final PhoneRecordDao phoneRecordDao;
    private final ContactPersonDao contactPersonDao;
    private final LoginUserDao loginUserDao;

    public DaoSession(SQLiteDatabase db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        noticeMessageDaoConfig = daoConfigMap.get(NoticeMessageDao.class).clone();
        noticeMessageDaoConfig.initIdentityScope(type);

        phoneRecordDaoConfig = daoConfigMap.get(PhoneRecordDao.class).clone();
        phoneRecordDaoConfig.initIdentityScope(type);

        contactPersonDaoConfig = daoConfigMap.get(ContactPersonDao.class).clone();
        contactPersonDaoConfig.initIdentityScope(type);

        loginUserDaoConfig = daoConfigMap.get(LoginUserDao.class).clone();
        loginUserDaoConfig.initIdentityScope(type);

        noticeMessageDao = new NoticeMessageDao(noticeMessageDaoConfig, this);
        phoneRecordDao = new PhoneRecordDao(phoneRecordDaoConfig, this);
        contactPersonDao = new ContactPersonDao(contactPersonDaoConfig, this);
        loginUserDao = new LoginUserDao(loginUserDaoConfig, this);

        registerDao(NoticeMessage.class, noticeMessageDao);
        registerDao(PhoneRecord.class, phoneRecordDao);
        registerDao(ContactPerson.class, contactPersonDao);
        registerDao(LoginUser.class, loginUserDao);
    }
    
    public void clear() {
        noticeMessageDaoConfig.getIdentityScope().clear();
        phoneRecordDaoConfig.getIdentityScope().clear();
        contactPersonDaoConfig.getIdentityScope().clear();
        loginUserDaoConfig.getIdentityScope().clear();
    }

    public NoticeMessageDao getNoticeMessageDao() {
        return noticeMessageDao;
    }

    public PhoneRecordDao getPhoneRecordDao() {
        return phoneRecordDao;
    }

    public ContactPersonDao getContactPersonDao() {
        return contactPersonDao;
    }

    public LoginUserDao getLoginUserDao() {
        return loginUserDao;
    }

}
